
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8" />
  <title>商家自助管理平台|微小区</title>
  <meta name="description" content="app, web app, responsive, admin dashboard, admin, flat, flat ui, ui kit, off screen nav" />
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  <link rel="stylesheet" href="{MODULE_URL}template/css/app.v2.css" type="text/css" />
  <link rel="stylesheet" href="{MODULE_URL}template/css/site.css" type="text/css" />
  <link rel="stylesheet" href="{MODULE_URL}template/css/jquery.validator.css" type="text/css" />
  <link href="{$_W['siteroot']}app/resource/css/font-awesome.min.css" rel="stylesheet">
  <script type="text/javascript" src="{$_W['siteroot']}app/resource/js/lib/jquery-1.11.1.min.js"></script>
</head>
<body>
  <header class="header bg-dark navbar myheader">
    <div class="collapse navbar-collapse pull-in">
      <span class="pull-left mylogo">
        <img src="" alt=""> <em class="b-r">微小区</em> <i>商家自助管理平台</i>
      </span>

    </div>
  </header>

  <section class="hbox stretch myhbox bg-light lter ">
    <section id="content">
      <section class="vbox">

        <div class="row m-n animated fadeInUp">
          <div class="loginbox">
            <section class="panel p-b-sm" style="width:500px;">
              <header class="panel-heading bg bg-primary text-center">立即注册帐号</header>
              <div class="panel-body">
                <form action="" class="" method="post" onsubmit="return checkMobile(this);" >
                  <label class="control-label text-danger text-center block m-b">欢迎注册微小区商家自助管理平台</label>
                  <div class="form-group msgPhone" style="margin-left:60px;">
                    {if $this->module['config']['businesscode']&&!$result}
                    <label class="control-label" style='display:block;float:left;line-height:30px;'>手机号&nbsp;&nbsp;</label>
                    <input type="text" placeholder="输入您的手机号"  class="form-control" id="phone" name="mobile" style='width:234px;display:block;float:left;' >
                    &nbsp;&nbsp;
                    <button type="button" class="btn btn-info btn-get-code" style="margin-top:0;" value="获取验证码"  onclick="sendVerifyCode();" id="verifyCodeBtn">获取验证码</button>
                    <span class="code_msg none"></span>
                  </div>

                  <div class="form-group" style="margin-left:60px;margin-top:30px;">
                    <label class="control-label" style='display:block;float:left;line-height:30px;'>验证码&nbsp;&nbsp;</label>
                    <input type="text" placeholder="请输入验证码"  class="form-control" name="verifycode" id="verifycode" style="width:100px;"></div>
                  <div class="form-group" style="margin-left:110px;margin-top:30px;">
                    <button type="submit" class="btn regFormBtn btn-block btn-h-sm no-radius regBtn2" style="width:234px;background:#5bb75b;color:white;" >下一步</button>
                    <input type="hidden" name="token" value="{$_W['token']}" />
                    {elseif empty($this->module['config']['businesscode']) || $result}
                    <div class="form-group" >
                    <label class="control-label">登录帐号:</label>
                    <input type="text" data-rule="手机:required;" placeholder="请输入手机号码" class="form-control" name="mobile" value='{if $result}{$_SESSION['mobile']}{/if}'>

                    </div>
                    <div class="form-group" >
                      <label class="control-label" >姓名:</label>
                      <input type="text" data-rule="姓名:required;" placeholder="请输入姓名" class="form-control" name="username" >
                    </div>
                    <div class="form-group" >
                      <label class="control-label" >密码:</label>
                      <input type="password" data-rule="密码:required;password;" placeholder="请输入密码" class="form-control" name="password" >
                    </div>
                    <div class="form-group">
                      <label class="control-label">确认密码:</label>
                      <input type="password" data-rule="确认密码:required;password;match(password)" placeholder="请再次输入密码" class="form-control" name="repassword"></div>
                    <div class="form-group" style="margin-top:-5px">
                      <!-- <button type="submit" class="btn regFormBtn btn-block btn-h-sm no-radius regBtn2">完成注册</button> -->
                      <button type="submit" name="submit" value="yes" class="btn btn-primary btn-lg" style="width:100%;">完成注册</button>
                      <input type="hidden" name="token" value="{$_W['token']}" />

                    {/if}
                    
                    <div class="line line-dashed"></div>
                    <p class="text-muted" style="margin-left:0px;float:left;margin-top:20px;">
                      <small>已经是商家用户?</small>
                    </p>
                    <a 
                    href="{php echo $this->createMobileUrl('business',array('op' => 'login'))}" class="btn btn-s-sm btn-info loginFormBtn pull-left" style="margin:13px 0 0 10px;padding:4px 12px;height:30px;"> <i class="fa fa-user"></i>
                      立即登录
                    </a>
                  </div>
                </form>
              </div>
            </section>

          </div>
        </div>
        <footer id="footer">
          <div class="text-center padder clearfix">
            <p class="text-xs">
              © 2014 weixiaoqu.wang,  All Rights Reserved
              <a href="http://www.miibeian.gov.cn" target="_blank"></a>
            </p>
          </div>
        </footer>
      </section>
    </section>
  </section>

</body>
</html>
<script type="text/javascript">

  function checkMobile(form) {
    if (!form['phone'].value) {
      alert('请输入您的手机号码。');
      return false;
    }
    if (form['phone'].value.search(/^([0-9]{11})?$/) == -1) {
      alert('请输入正确的手机号码！');
      return false;
    }
    if (!form['verifycode'].value) {
      alert('请输入发送给您的验证码。');
      return false;
    }
    return true;
  }
  function sendVerifyCode() {
    var mobile = $('#phone').val();
    if (!mobile) {
      alert('请输入您的手机号码！');
      return false;
    }
    if (mobile.search(/^([0-9]{11})?$/) == -1) {
      alert('请输入正确的手机号码！');
      return false;
    }
    $('#verifyCodeBtn').addClass('active');
    $('#verifyCodeBtn').attr('disabled', true);
    var countdown = 60;
    timer = setInterval(function(){
      $('#verifyCodeBtn').html(countdown--);
      if (countdown == 0) {
        $('#verifyCodeBtn').removeClass('active');
        $('#verifyCodeBtn').html('重新发送');
        clearInterval(timer);
        $('#verifyCodeBtn').attr('disabled', false);
      }
    },1000);
    $.getJSON('{php echo $this->createMobileUrl('verifycode')}&mobile='+mobile+'&type=business', function(s){
      // if (!s.message.status) {
      //   alert(s.message.message);
      //   $('#verifyCodeBtn').removeClass('active');
      //   $('#verifyCodeBtn').html('重新发送');
      //   clearInterval(timer);
      //   $('#verifyCodeBtn').attr('disabled', false);
      //   return false;
      // }
    });
  }

</script>